<?php
require('PDF/fpdf.php');
require_once('connectvars.php');

class PDF extends FPDF
{
//Page header
function Header()
{
    //Logo
    $this->Image('OliveLogo.jpg',10,8,33);
    //Arial bold 15
    $this->SetFont('Arial','B',15);
    //Move to the right
    $this->Cell(80);
    //Title
    $this->Cell(50,10,'Employee List',1,0,'C');
    //Line break
    $this->Ln(20);
}

//Page footer
function Footer()
{
    //Position at 1.5 cm from bottom
    $this->SetY(-15);
    //Arial italic 8
    $this->SetFont('Arial','I',8);
    //Page number
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}

//Instanciation of inherited class
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
$dbc = mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);
$date = date("m");
$query = "SELECT * FROM employees";
$found = mysqli_query($dbc, $query) or die("Error");
while($data = mysqli_fetch_array($found)){
    $message = "Name: " . $data['Employee_Name']. "     Employer: " . $data['Employer'].
    "      Carrier: " . $data['Carrier']. "\nCoverage: " . $data['Type']. "     Phone: " . $data['Phone'].
    "      Social Security: " . $data['Social'] . "\n\n";

    $pdf->MultiCell(0,10,$message,0,1);
}
$pdf->Output();
?>